<%--
  @author Kusal Samarakoon
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script src="${pageContext.request.contextPath}/js/printer.js" type="text/javascript"></script>

<style type="text/css">
    #printOuter {
    /*font-family: serif, arial, BhashitaComplex, Bhashitha2, Sri Tamil;*/
        font-size: 12pt;
        line-height: 2.0;
    }

    #printOuter p {
        font-size: 12pt;
        text-align: justify;
        line-height: 2.0;
    }

    #printOuter td {
        font-size: 12pt;
    }

    textarea,select,input{
         border: 1px solid #000;
         background:white;
        color: #000;
    }

    


    @media print {
        .bold-label-tag {
            font-weight: bold;
        }

    textarea,select,input{
         border: 1px solid #000;
         background:#FFF;
         color: #000;
    }


    }
</style>

<script type="text/javascript">


    $(function () {
        $('#cancelBtnId').val($('#cancelBtn').val());
        $('#printBtnId').val($('#printBtn').val());

    });

function changeHectareTemp() {
        var he = 0, ac = 0, ro = 0, pe = 0, temp = 0;
        var cont = 2.47105381467;

        he = parseFloat($("#hectareId").val());
        he = he.toFixed(4);
        ac = Math.floor(he * cont);
        temp = (he * cont - ac) * 4;
        ro = Math.floor(temp);
        temp = (temp - ro) * 40;
        pe = temp.toFixed(4);
        $("#acreId").text(ac);
        $("#roodsId").text(ro);
        $("#perchesId").text(pe);

        $("#hectareId").text(he);

    }

function changeHectareKml() {
        var he = 0,ac = 0,ro = 0,pe = 0,temp = 0;
        var cont = 2.47105381467;
        he = $("#kmlArea").val() / 10000;

        if (1 > he > 0) {
            he = parseFloat(he);
        }
        ac = Math.floor(he * cont);
        temp = (he * cont - ac) * 4;
        ro = Math.floor(temp);
        temp = (temp - ro) * 40;
        pe = temp.toFixed(4);
        $("#kmlacreId").text(ac);
        $("#kmlroodsId").text(ro);
        $("#kmlperchesId").text(pe);
        $("#kmlhectareId").text(he.toFixed(4));
    }

    $(function () {

        var hectare = $("#hectareId").val();
        hectare = parseFloat(hectare);
        if (hectare > 0) {
            changeHectareTemp();
        }else{
              $("#acreId").text(0);
             $("#roodsId").text(0);
             $("#perchesId").text(0);
        }
       
        $('#area').hide();
        var kArea = $("#kmlArea").val()
        if (kArea > 0) {
            changeHectareKml();
        }else{
             $("#kmlacreId").text(0);
             $("#kmlroodsId").text(0);
             $("#kmlperchesId").text(0);
        }

    });








</script>


<div id="land-registration-module-home-title" class="module-home-title">

    <%--<s:a href="home.do">
        <span><img src="${pageContext.request.contextPath}/images/registration-form.png"
                   alt="Enter Detailed Land Information">
        <s:label value="%{getText('detail_land_info.label')}"/></span>
    </s:a>--%>


</div>

<div id="printbtn" class="form-button-div right-align">
    <%--<input class="printButton" type="button" value="Print" onclick="getPortraitPrintOut();">--%>
   <%-- <input type="button" id="printBtnId" onclick="printPage('printOuter', 'A4', 'P');"/>
    <input class="printButton" type="button" id="cancelBtnId" onclick="goBack();">--%>
    <s:form>
        <div id="printCancelBtn" class="form-button-div right-align">
            <input type="button" id="printBtnId" onclick="printPage('printOuter', 'A4', 'P');"/>
            <input type="button" id="cancelBtnId" onclick="window.close();"/>
            <%--<s:submit cssClass="cancel" action="home" value="%{getText('cancel.label')}"/>--%>
        </div>
    </s:form>

</div>


<div id="printOuter" class="form-outer">

    <s:form method="POST" id="gov-land-init-info-form" name="init-land-info" enctype="multipart/form-data">

        <h2><s:label value="%{getText('detail_land_info.label')}"/></h2>

        <s:include value="././landDetailsPrintReport.jsp"/>

        <div style="page-break-after:always;"></div>

        <s:include value="././landAlienationInfomationPrintReport.jsp"/>


        <table class="width-100">
            <tr>
                <td><s:label value="%{getText('comments.label')}"/></td>
                <td colspan="3"><s:textarea name="land.approvalNote" cssClass="width-595-px" disabled="true"/></td>
            </tr>
        </table>

        <div style="page-break-after:always;"></div>

        <fieldset>


            <table id="geoDetails" class="width-100">
                <h2><s:label value="%{getText('geo_info.label')}"/></h2>

                <tr>
                    <td><s:label value="%{getText('geoParcelCode.label')}"/></td>
                    <td colspan="3"><s:property value="land.getGeoParcelCode()"/></td>
                </tr>

                <s:if test="land.mode.ordinal() == 1 || land.mode.ordinal() == 2">

                    <tr id="area">
                        <td><s:label value="Area"/></td>
                        <td colspan="3"><s:textfield id="kmlArea" cssClass="width-200-px" name="land.kmlLandArea"
                                                     readonly="true"/></td>
                    </tr>
                    <tr>
                        <td><s:label value="%{getText('kml_land_extent.label')}"/></td>
                        <td colspan="3">
                            <table class="width-100">
                                <tr>
                                    <td><s:label value="%{getText('hectare.label')}"/></td>
                                    <td colspan="5"><s:label id="kmlhectareId" name="kmlhectare"
                                                                 cssStyle="width: 80px;"
                                                                 readonly="true" cssClass="bl"/></td>

                                </tr>
                                <tr>
                                    <td><s:label value="%{getText('acre.label')}"/></td>
                                    <td><s:label id="kmlacreId" name="kmlacre" cssStyle="width: 80px;"
                                                     readonly="true" cssClass="bl"/></td>
                                    <td><s:label value="%{getText('roods.label')}"/></td>
                                    <td><s:label id="kmlroodsId" name="kmlroods" cssStyle="width: 80px;"
                                                     readonly="true" cssClass="bl"/></td>
                                    <td><s:label value="%{getText('perches.label')}"/></td>
                                    <td><s:label id="kmlperchesId" name="kmlperches" cssStyle="width: 80px;"
                                                     readonly="true" cssClass="bl"/></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <s:include value="../map.jsp"/>

                </s:if>




            </table>

        </fieldset>

        <%--<div id="printCancelBtn" class="form-button-div right-align">

            <s:submit cssClass="cancel" action="detailForm" value="%{getText('cancel.label')}"/>
        </div>--%>


    </s:form>
    <s:form id="load-form">
        <s:hidden id="alienationMethod" name="alienationType"/>
        <s:hidden id="editMode" name="editMode"/>
    </s:form>
</div>
<s:hidden id="pls_enter_reference_no" value="%{getText('pls_enter_reference_no')}"/>
<s:hidden id="pls_enter_name_of_the_land" value="%{getText('pls_enter_name_of_the_land')}"/>
<s:hidden id="pls_enter_valid_no" value="%{getText('pls_enter_valid_no')}"/>
<s:hidden id="pls_enter_name_of_the_land" value="%{getText('pls_enter_name_of_the_land')}"/>
<s:hidden id="pls_enter_plan_no" value="%{getText('pls_enter_plan_no')}"/>
<s:hidden id="pls_enter_lot_no" value="%{getText('pls_enter_lot_no')}"/>
<s:hidden id="pls_select_gn_division" value="%{getText('pls_select_gn_division')}"/>
<s:hidden id="userRole" name="user.role.id"/>

<s:hidden id="printBtn" value="%{getText('print.label')}"/>
<s:hidden id="cancelBtn" value="%{getText('cancel.label')}"/>

<%--<s:hidden id="pls_select_alienation_method" value="%{getText('pls_select_alienation_method.label')}"/>--%>
